import {queryOrgPathList, queryRootMeun} from "@/axios/apis";

const queryRootOrgPath = (powers) => {
    return queryOrgPathList({
        orgCodeList: powers == '1106' ? ['00000000'] : powers.split(',')
    })
}
const selectSuperCode = (res, powers) => {
    return queryRootMeun({
        orgPathList: res,
        orgCodeList: powers == '1106' ? ['00000000'] : powers.split(','),
        index: '1'
    })
}
// 调用挂载在原型上的方法
// 获取当前登录用户所在组织机构
export const getOrganizationForLogged = (powers) => {
    return new Promise(async (resolve, reject) => {
        const resultA = await queryRootOrgPath(powers);
        resolve(await selectSuperCode(resultA, powers))
    })
}


